from mcp.server.fastmcp import FastMCP

# Create an MCP server
mcp = FastMCP("TC Server")

@mcp.tool()
def say_hello(name: str) -> str:
    """Generate a personalized greeting message"""
    return f"Hello, {name}! Welcome to our MCP service!"

@mcp.tool()
def say_goodbye(name: str) -> str:
    """Generate a personalized goodbye message"""
    return f"Goodbye, {name}! Thanks for using our service!"

@mcp.tool()
def add_numbers(a: float, b: float) -> float:
    """Add two numbers"""
    return a + b

@mcp.tool()
def subtract_numbers(a: float, b: float) -> float:
    """Subtract the second number from the first"""
    return a - b

@mcp.tool()
def multiply_numbers(a: float, b: float) -> float:
    """Multiply two numbers"""
    return a * b

@mcp.tool()
def divide_numbers(a: float, b: float) -> float:
    """Divide the first number by the second. Raise an error if divisor is zero."""
    if b == 0:
        raise ValueError("Division by zero is not allowed")
    return a / b

@mcp.resource("greeting://{name}")
def get_greeting_resource(name: str) -> str:
    """Get a greeting resource for the specified name"""
    return f"Greetings resource for {name}: Hello and welcome!"

if __name__ == "__main__":
    print("MCP TC Server is starting with stdio transport...")
    mcp.run(transport="stdio")